package com.proint1.udea.produccion.ctl;

import java.awt.Label;
import java.io.IOException;
import java.util.List;

import org.apache.log4j.Logger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Bandbox;
import org.zkoss.zul.Button;
import org.zkoss.zul.Column;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Row;
import org.zkoss.zul.Rows;
import org.zkoss.zul.Textbox;

import com.proint1.udea.produccion.entidades.Autor;
import com.proint1.udea.produccion.ngc.impl.AutorServiceImpl;

public class gestionAutoresCtl extends GenericForwardComposer {
	Bandbox bd;
	Textbox sdfsf;
	Button btnNuevoAutor;
	Grid grid;
	Column columnasGrid;

	// private static Logger logger = Logger.getLogger(gestionAutoresCtl.class);

	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		// logger.info("cargando ventana de consultar personas");

	}

	public void onClick$btnNuevoAutor() {
		btnNuevoAutor.setLabel("asdasdasdsad");

	}

	public void onCreate() {
		Rows rows = new Rows();
		AutorServiceImpl autorService = new AutorServiceImpl();
		List<Autor> autores = autorService.listar();
		for (Autor autor : autores) {
			//grid.appendChild(new org.zkoss.zul.Label(String.valueOf(autor.getId())));
			Row row = new Row();
			row.appendChild(new org.zkoss.zul.Label(autor.getId()+""));
			rows.appendChild(row);
		}
		grid.appendChild(rows);
		//columnasGrid.appendChild(child)

	}
}
